package com.iweb.service;

import com.common.datasource.DataSourceUtil;
import com.iweb.dao.StrategyDao;
import com.iweb.dao.StrategyDaoImpl;
import com.iweb.pojo.Admin;
import com.iweb.pojo.Strategy;

import java.util.ArrayList;
import java.util.List;

public class StrategyService {

   public List<Strategy> selectStrategyList(String title) {
      List<Strategy> strategies = new ArrayList<>();

       Admin admin = null;
       //连接数据库
       DataSourceUtil dataSourceUtil = new DataSourceUtil();
       dataSourceUtil.init();
       //创建数据库操作对象
       StrategyDao strategyDao = new StrategyDaoImpl(dataSourceUtil.getConnection());

       try {
           //查找商品
           strategies = strategyDao.selectList(title);


       }catch (Exception e){
           e.printStackTrace();
       }finally {
           dataSourceUtil.close();
       }

       return strategies;
   }



}
